home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-12-11 | 2.3 KB | 82 lines | [TEXT/MPS ] |
- // UAEClientCommand.cp
- // Copyright © 1991 by Apple Computer, Inc. All rights reserved.
- // Kent Sandvik DTS
- // This file contains all the TAEClientCommand member functions, i.e.
- // for creating an Apple event which will query a server over the network.
-
-
- #ifndef __AECLIENTCOMMAND__
- #include "UAEClientCommand.h"
- #endif
-
-
- // Empty constructor - for avoiding ptabs in global data space
- #pragma segment ARes
- TAEClientCommand::TAEClientCommand() {}
-
- // Put together the client AppleEvent, which will call the server asking for
- // Gestalt information
-
- #pragma segment ASelCommand
- pascal void TAEClientCommand::IAEClientCommand( CommandNumber theNum,
- TAEDocument* theDocument,
- AEEventID theID)
- {
- AEAddressDesc theAddress;
- FailInfo fi;
-
- fDocument = theDocument; // save document wherefrom command is issued
-
- this->IClientCommand(theNum, theDocument, kCantUndo, kDoesNotCauseChange, NULL);
-
- if(fi.Try()){
- // setup fMessage to contain the data for our Gestalt GetData AppleEvent
-
- theDocument->GetAEGestaltAddress(theAddress);
-
- TAppleEvent* aMessage = new TAppleEvent; // create AE object
- aMessage->IAppleEvent(kMacAppClass, theID, theAddress, kAEQueueReply);
- fMessage = aMessage;
-
- fi.Success();
- }
- else{
- this->Free();
- fi.ReSignal();
- }
- }
-
-
- // Process replies that gets back to the client side from the AE server
-
- #pragma segment ADoCommand
- pascal void TAEClientCommand::ProcessReply(TAppleEvent* theReply)
- {
- CStr255 theResponse;
- long actualSize;
- DescType actualCode;
- struct Configuration tempConfig;
-
- inherited::ProcessReply(theReply); // handle inherited processing
- FailOSErr(theReply->ReadShort('errn')); // check for AE errors
-
- // if OK, continue processing the reply - store it in the document
- theReply->ReadParameterPtr(kAEConfig, typeConfig, actualCode,
- (Ptr)&tempConfig,
- sizeof(Configuration), actualSize);
-
- // Now move the tempConfig to the fDocument itself.
- fDocument->ReadConfiguration(&tempConfig);
-
- // FUTURE: Make a TProcessGestaltCommand which will process the information
- // and store it in the TInformationView
- // TProcessGestaltCommand aCommand = new TProcessGestaltCommand(this,tempConfig);
- // and so on...
-
- // Process the reply to a more suitable format, this is done from the
- // document itself for the view class
-
- fDocument->ProcessAEInformation();
- }
-
-